package cn.edu.hunau.oop.day04.demo;

import org.junit.Test;

/**
 * @author hb
 * @date 2025-08-07 10:14:53
 */
public class TemplateMethodTest {
    @Test
    public void test01(){
        TemplateMethod tm=new Foo();
        tm.call();
    }
}

abstract class TemplateMethod{

    public void method01(){
        System.out.println("固定逻辑处理1....");
    }

    public abstract  void toDo();
    public void method02(){
        System.out.println("固定逻辑处理2....");
    }

    public void call(){
       method01();
       toDo();
       method02();
    }
}

class Foo extends TemplateMethod{
    @Override
    public void toDo() {
        System.out.println("Foo具体逻辑处理...");
    }
}